import { App } from "vue";
import auths from "../directives/auths";
import copy from "../directives/copy";
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import * as scIcons from '@renderer/assets/icons';
// 全局组件
import XlxPagination from '@renderer/components/pagination/index.vue'
import XlxCitySelect from '@renderer/components/citySelect/index.vue'
import XlxClientTable from '@renderer/components/clientTable/index.vue'

/** 注册机 */
export default {
	install: (app: App) => {
		// 注册自定义指令
		app.directive('auths', auths)
		app.directive('copy', copy)

		// 统一注册el-icon图标
		for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
			app.component(key, component)
		}
		// 统一注册sc-icon图标
		for (let icon in scIcons) {
			app.component(`ScIcon${icon}`, scIcons[icon])
		}

		// 注册全局组件
		app.component('XlxPagination', XlxPagination)
		app.component('XlxCitySelect', XlxCitySelect)
		app.component('XlxClientTable', XlxClientTable)
	}
}